<?php
/**
 * Created by PhpStorm.
 * User: Raytine
 * Date: 2018/8/30
 * Time: 17:33
 */

namespace PddWechat\Models\User\Service;

use PddWechat\Models\User\Data\WithdrawCashData;
use PddWechat\Models\User\Param\UserWithdrawListParam;

class UserWithdrawList
{
    public function __construct()
    {
        $this->withdrawCashData = new WithdrawCashData();
    }

    public function execute($basePageInfo)
    {
        /** @var UserWithdrawListParam $params */
        $params = $basePageInfo->params;
        $withdrawList = $this->withdrawCashData->selectUserWithdrawList($params);
        foreach ($withdrawList as $item) {
            if($item->status == 0) {
                $item->withdrawDesc = "待转账";
            } else if($item->status == 1) {
                $item->withdrawDesc = "已转账";
            }
        }
        $data['list'] = $withdrawList;
        $data['total'] = $this->withdrawCashData->selectUserWithdrawNum();
        return $data;
    }
}